package com.ivo.activiti.config;

import com.ivo.activiti.bpmn.IvoActivitiEventListener;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author wj
 * @version 1.0
 */
@Configuration
public class ActivitiConfig implements ProcessEngineConfigurationConfigurer {

    @Resource
    private IvoActivitiEventListener ivoActivitiEventListener;

    @Override
    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
        List<ActivitiEventListener> activitiEventListenerList =new ArrayList<>();

        activitiEventListenerList.add(ivoActivitiEventListener);//配置全局监听器

        processEngineConfiguration.setEventListeners(activitiEventListenerList);
    }
}
